/**
 * Copyright (c) 2012 Axa Holding Belgium, SA. All rights reserved.
 * This software is the confidential and proprietary information of the AXA Group.
 */
package chabernac.android.wordbattle.paint.boggle;

import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.view.View;
import chabernac.android.wordbattle.paint.iDrawable;

public class WordDrawable extends iDrawable {
  private final String myWord;
  private final Paint myPaint = new Paint();

  public WordDrawable( String aWord, float aSize ) {
    super();
    myWord = aWord;
    myPaint.setTextSize( aSize );
    myPaint.setColor( 0x550000FF );
  }

  @Override
  public void paint( Canvas aCanvas, View aView ) {
    Rect theFontBounds = new Rect();
    myPaint.getTextBounds(myWord, 0 , myWord.length() , theFontBounds);
    aCanvas.drawText( myWord, aView.getWidth() / 2 - theFontBounds.width() / 2, aView.getHeight() / 2  + theFontBounds.height() / 2, myPaint );
  }

}
